<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class TypeInputDTO extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     * 'groupId', 'name', 'email', 'mobile'
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|max:10',
            'sort' => 'numeric',
            'title' => 'max:140',
            'picture' => 'required|max:255',
            'keyword' => 'max:255',
            'description' => 'max:255',
            'mode' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => '栏目标题必须',
            'name.max' => '栏目标题不能超过10个字符',
            'picture.required' => '请上传banner图',
            'picture.max' => '图片地址不合法',
            'title.max' => 'SEO标题不能超过255个字符',
            'keyword.max' => '关键字不能超过255个字符',
            'description.max' => '描述不能超过255个字符',
            'mode.required' => '请选择模板',
        ];
    }
}
